<!-- Yandex Maps -->
<script src="http://api-maps.yandex.ru/2.0/?load=package.full&amp;lang=ru-RU" type="text/javascript"></script>

<?= View::factory('pieces/left_body', array('catalog' => $catalog, 'parent_id' => NULL, 'type' => 0)) ?>
<div class="right_body">
	<div class="right_body_cont">
		<? $maps = ''; $count = count($contacts); ?>
		<? foreach ($contacts as $key => $item): ?>
			<h1>
				<?= $item->title ?>
			</h1>
			<p>
				<?= $item->text ?>
			</p>
			<div class="map_cont">
				<div id="map_<?= $key ?>" style="width: 680px; height: 300px"></div>
			</div>
			<?
				//$d = ($key + 1) == $count ? ';' : ',';

	            $maps .= '
	            	var myMap_'.$key.' = new ymaps.Map("map_'.$key.'", {
	            		center: ['.$item->coordinates.'],
	            		zoom: 12
		            });

					myPlacemark_'.$key.' = new ymaps.Placemark(['.$item->coordinates.']);
					myMap_'.$key.'.geoObjects.add(myPlacemark_'.$key.');
					myMap_'.$key.'.controls.add("zoomControl", { left: 5, top: 5 });
				';
			?>
		<? endforeach ?>
		<script type="text/javascript">
			ymaps.ready(init);

			function init () {
				<?= $maps ?>
			}
		</script>
	</div>
</div>